/****************************************************************************************/
/*                                                                     					*/
/*  M16C/62P Group Program Collection                                  					*/
/*                                                                     					*/
/*  FILE NAME : flash_header.h                                       					*/
/*  CPU       : This program is the Serial flash boot loader by Xmodem data transfer	*/
/*  HISTORY   : 2006.12.08 Ver 0.01                                    					*/
/*                                                                    	 				*/
/*  Copyright (C) 2006. Renesas Technology Corp.                       					*/
/*  Copyright (C) 2006. Renesas Solutions Corp.                        					*/
/*  All right reserved.                                                					*/
/*                                                                     					*/
/*****************************************************************************************/

#ifndef _FLASH_HEADER_H

#define ROM_SIZE_512KB              1
#define ROM_SIZE_384KB              2

#define ROM_SIZE                    ROM_SIZE_384KB

#if(ROM_SIZE==ROM_SIZE_384KB)
#define BLOCK_NUM                   12
#elif(ROM_SIZE==ROM_SIZE_512KB)     
#define BLOCK_NUM                   14
#endif

#define BLANK_VALUE 				0xFFFF
#define MAX_FLASH_ADDR				0xFC000
#define NO_OF_FLASH_BLOCKS			11
#define FLASH_LINE_SIZE 			16

#define BLANK						1
#define NOT_BLANK					2
#define PROG_PASS					0x01
#define PROG_FAIL					0x02
#define ERASE_PASS					0x01
#define ERASE_FAIL					0x02

// commands
#define BLOCK_ERASE					0x20
#define READ_STATUS_REGISTER		0x70
#define PROGRAM_CMD					0x40

// function locations in pointer table
#define ERASEBLOCK_OFFSET			0
#define PROGRAM_OFFSET				1

unsigned char BlockErase( unsigned long BlockNum, unsigned short *Dummy );
unsigned char Program_Bytes( unsigned long Address, unsigned char length, unsigned short *Data );

#endif

